using System;
using System.Text;
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using MSRI.HelperClasses;
using Microsoft.Practices.EnterpriseLibrary.Data;
using System.Data;
using System.Xml;
using System.IO;
using Instedd.Labs.Geo.Library.Kml;
using Instedd.Labs.Geo.Library.GPS;
using System.Configuration;

namespace Instedd.Labs.Geo.Library.Tests.GPS
{
    /// <summary>
    /// Summary description for UnitTest1
    /// </summary>
    [TestClass]
    public class GoogleGeoCoderFixture
    {
        public GoogleGeoCoderFixture()
        {}

        [TestMethod]
        public void ValidPostalAddressReturnsLocation()
        {
            GoogleGeoCoder geoCoder = new GoogleGeoCoder();
            geoCoder.Initialize(ConfigurationManager.AppSettings["googleMapsKey"]);

            LatLong location = geoCoder.GetLatLongFromPostalAddress("15606 NE 40th Street,Redmond,WA,98052");
            Assert.AreEqual(47.646057, location.Lat);
            Assert.AreEqual(-122.13213, location.Long);
        }

        [TestMethod]
        public void InvalidPostalAddressReturns()
        {
            GoogleGeoCoder geoCoder = new GoogleGeoCoder();
            geoCoder.Initialize(ConfigurationManager.AppSettings["googleMapsKey"]);

            LatLong location = geoCoder.GetLatLongFromPostalAddress("Invalid Address");
            Assert.IsNull(location);
        }
    }
}
